package com.parsechina.hpush.broker.parser;


import io.netty.handler.codec.mqtt.*;

/**
 * @author linfeng
 * @since 2016/11/22
 */
public class UnsubAckMessage extends PushMessage {
    private static final long serialVersionUID = 256863086946961758L;

    private MqttUnsubAckMessage unsubAckMessage;
    private int messageId;

    public UnsubAckMessage(MqttUnsubAckMessage msg) {
        super(msg);
        this.unsubAckMessage = msg;
    }

    public UnsubAckMessage() {
    }

    public int getMessageId() {
        return messageId;
    }

    public void setMessageId(int messageId) {
        this.messageId = messageId;
    }

    public MqttUnsubAckMessage build() {
        MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0);
        MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);
        return new MqttUnsubAckMessage(fixedHeader, variableHeader);
    }
}
